<template>
    <div>
        <!--MainHeader -->
        <MainHeader/>
        <!--搜索条 -->
        <div v-if="routerPath !== '/home/loginCompany'
                && routerPath !== '/home/loginJob'
                && routerPath !== '/home/registerCompany'
                && routerPath !== '/home/registerJob'
        ">
            <MainHeaderSearch/>
        </div>


        <div v-else>
            <MainLoginHeadCommon/>
        </div>

        <!--头部导航条 动态路由-->
        <div v-if="routerPath !== '/home/loginJob'
            &&
            routerPath !== '/home/loginCompany'
            &&
            routerPath !== '/home/registerJob'
            &&
            routerPath !== '/home/registerCompany'
            &&
            routerPath !== '/home/resumeRegister'
            &&
            routerPath !== '/home/personCenter'
            &&
            routerPath !== '/home/companyCenter'
            &&
            routerPath !== '/home/personCenter/myDeliverInfo'
            &&
            routerPath !== '/home/companyCenter/workjobCreateInfo'
            &&
            routerPath !== '/home/companyCenter/myPublishWorkJobInfoTwo'
            &&
            routerPath !== '/home/companyCenter/myPublishWorkjobInfo'
            &&
            routerPath !== '/home/companyCenter/myDeliveryCreateUserPosition'
            &&
            routerPath !== '/home/companyCenter/companyCreateInfo'
            &&
            routerPath !== '/home/companyCenter/companyUserInfo'
">
            <MainNav/>
        </div>



        <div v-if="routerPath === '/home'">
            <MainContent/>
            <MainFooter/>
        </div>

<!--        <router-view></router-view>-->

        <router-view></router-view>

        <!--底部导航条-->
        <FooterNav/>
        <!--版权信息-->
        <CopyRight/>
<!--        <router-view name="MainHeader"></router-view>-->
<!--        <router-view name="MainHeaderSearch"></router-view>-->
<!--        <router-view name="MainLoginHeadCommon"></router-view>-->
<!--        <router-view name="MainContent"></router-view>-->
<!--        <router-view name="MainFooter"></router-view>-->
<!--        <router-view name="FooterNav"></router-view>-->
<!--        <router-view name="CopyRight"></router-view>-->


<!--        <MainHeader/>-->
<!--        <MainHeaderSearch/>-->
<!--        <MainContent/>-->
<!--        <MainFooter/>-->
    </div>
</template>

<script>
    import MainHeader from './main-header'
    import MainContent from './main-content'
    import MainFooter from './main-footer'
    import MainHeaderSearch from './main-header-seacher'
    import MainNav from './main-nav'
    import FooterNav from '../components/component/common/footer-nav-common'
    import CopyRight from '../components/component/common/footer-copyright-common'
    import MainLoginHeadCommon from '../components/component/common/main-login-head-common'
    export default {
        name: "main-home",
        data(){
            return{
                routerPath:''
            }
        },
        components:{
            MainHeader,
            MainContent,
            MainFooter,
            MainHeaderSearch,
            MainNav,
            MainLoginHeadCommon,
            FooterNav,
            CopyRight
        },
        created() {
        },
        mounted() {
            this.routerPath = this.$route.path
            // console.log("路由的路径",this.$route.path)
            // console.log("路由的名字",this.$route.name)
            console.log("this.routerPath ====>" ,this.routerPath)
            // console.log($route.name)
        },
        //监听路由的变化
        watch:{
            $route:{
                handler(val,oldval){
                    //console.log("new router ==> ",val);//新路由信息
                    console.log("old router ==> ",oldval);//老路由信息
                    this.routerPath = val.path
                },
                // 深度观察监听
                deep: true
            }
        }

    }
</script>

<style>
    body{
        padding: 0;
        margin: 0;
        background-color: #F3F3F3;
    }
    a{
        text-decoration: none;
    }

</style>
